from public.action import *
from public.tools import *
from public.testData import *
testCase = "DBshop0012_搜索商品"
firefox=getDriver()
openBrowser(firefox,urlAdmin)
logInAdmin(firefox)

adminMenu2(firefox,"商品管理","管理商品")
# 1.选择商品名称，输入“美的”，点击“搜索”按钮。
firefox.find_element_by_name("goods_name").send_keys("美的")
firefox.find_element_by_xpath("(//button)[1]").click()
time.sleep(2)
# 2.搜索成功美的的后台商品
#断言
try:
    firefox.find_element_by_xpath('//td[contains(.,"美的")]').is_displayed()
    writeLog("%s 测试通过" % testCase)
except:
    writeLog("%s 测试失败" % testCase)
    getPhoto(firefox)
firefox.quit()
